import { getDrawList, toTree, regionList, getDrawListByOrgId, addDraw } from './api'
export default {
    data() {
        return {
            replaceFields: {
                title: 'name',
                key: 'code',
                value: 'code',
                children: 'children'
            },
            orgId: 'e5a0c9af-117b-4f66-93a9-e963bdc60001'
        }
    },
    mounted() {

    },
    methods: {
        //data.systemType = 0(全部) 1(无线) 2(红外) 4(光纤)
        // data.orgId = 区域/设备uuid
        async getlistOrgDeviceTree() {
            let data = {
                orgId: this.orgId,
                systemType: 0,
            }
            const res = await getDrawList(data)
            return toTree(res.data)
        },
        async getRegionList() {
            let data = {
                orgId: this.orgId,
                pageNum: 1,
                pageSize: 10
            }
            const res = await regionList(data)
            return toTree(res.data.list)
        },
        async getDrawListByOrgId(id) {
            let data = {
                orgId: id,
            }
            return await getDrawListByOrgId(data)
        },
        async addDraw(data) {
            return await addDraw(data)
        }
    }
}